package cn.edu.tsinghua.xkk.correction;

import java.util.LinkedList;
import java.util.List;

public class WordIndex
{
	public char sig;
	public List <WordIndex> nextLevel = null;
	public List <Integer> thisLevel = null;
	public int level = 0;
	
	public WordIndex (int i)
	{
		nextLevel = new LinkedList <WordIndex> ();
		thisLevel = new LinkedList <Integer> ();
		level = i;
	}
	
	public List <Integer> searchAll ()
	{
		List <Integer> answer = new LinkedList <Integer> ();
		
		answer.addAll(thisLevel);
		if (nextLevel.size() == 0)
		{
			return answer;
		}
		else
		{
			for (int i = 0; i < nextLevel.size(); i++)
			{
				answer.addAll(nextLevel.get(i).searchAll());
			}
			return answer;
		}
	}
	
	public List <Integer> searchThisLevel ()
	{
		List <Integer> answer = new LinkedList <Integer> ();
		answer.addAll(thisLevel);
		return answer;
	}
}
